package visitor.pattern.simple.browser.visitors.subscribe;

import visitor.pattern.simple.browser.internet.AbstractHtmls;
import visitor.pattern.simple.browser.internet.Htmls;

import java.util.ArrayList;
import java.util.List;

public abstract class AbstractSubscribeVisitor implements SubscribeVisitor{

    @Override
    abstract public List<Htmls.Types> getNodes();

    @Override
    public void visitNode(Htmls htmls) {

    }

    @Override
    public void visit(ArrayList htmlList) {
        List<Htmls.Types> nodes = this.getNodes();
        for (Object htmls : htmlList){
            if(nodes.contains(((AbstractHtmls)htmls).getType())){
                this.visitNode((Htmls) htmls);
            }
        }
    }
}
